package com.study.model.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;

/**
 * The persistent class for the pur_app database table.
 * 
 */
@Entity
@Table(name = "pur_app")
@NamedQuery(name = "PurApp.findAll", query = "SELECT p FROM PurApp p")
public class PurApp implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "app_id")
	private String appId;

	private String address;

	@Temporal(TemporalType.DATE)
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date appdate;

	private String appdept;

	private String applicant;

	private String purtype;

	private String remarks;

	private String sourceid;

	private String sourcetype;

	private int state;

	private String theme;

	// bi-directional many-to-one association to PurAppDetail
	@OneToMany(mappedBy = "purApp")
	private List<PurAppDetail> purAppDetails;

	public PurApp() {
	}

	public String getAppId() {
		return this.appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getAppdate() {
		return this.appdate;
	}

	public void setAppdate(Date appdate) {
		this.appdate = appdate;
	}

	public String getAppdept() {
		return this.appdept;
	}

	public void setAppdept(String appdept) {
		this.appdept = appdept;
	}

	public String getApplicant() {
		return this.applicant;
	}

	public void setApplicant(String applicant) {
		this.applicant = applicant;
	}

	public String getPurtype() {
		return this.purtype;
	}

	public void setPurtype(String purtype) {
		this.purtype = purtype;
	}

	public String getRemarks() {
		return this.remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getSourceid() {
		return this.sourceid;
	}

	public void setSourceid(String sourceid) {
		this.sourceid = sourceid;
	}

	public String getSourcetype() {
		return this.sourcetype;
	}

	public void setSourcetype(String sourcetype) {
		this.sourcetype = sourcetype;
	}

	public int getState() {
		return this.state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getTheme() {
		return this.theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public List<PurAppDetail> getPurAppDetails() {
		return this.purAppDetails;
	}

	public void setPurAppDetails(List<PurAppDetail> purAppDetails) {
		this.purAppDetails = purAppDetails;
	}

	public PurAppDetail addPurAppDetail(PurAppDetail purAppDetail) {
		getPurAppDetails().add(purAppDetail);
		purAppDetail.setPurApp(this);

		return purAppDetail;
	}

	public PurAppDetail removePurAppDetail(PurAppDetail purAppDetail) {
		getPurAppDetails().remove(purAppDetail);
		purAppDetail.setPurApp(null);

		return purAppDetail;
	}

}